<template>
  <div>
    <h1>{{ counter }}</h1>
    <h2>{{ douCounter }}</h2>
  </div>
</template>

<script>
// 辅助函数
import { mapState, mapGetters, mapActions } from 'vuex'
export default {
  computed: {
    ...mapState(['counter']),
    ...mapGetters(['douCounter'])
  },
  methods: {
    ...mapActions(['GET_COUNTER'])
  },
  created() {

    // 提交mutations
    // this.$store.commit('mutataions名字', 参数对象)
    // this.$store.commit({ type: 'mutataions 名字', ...参数对象 })

    // 分发 actions
    // this.$store.dispatch('actions 名字', 参数对象)
    // this.$store.dispatch({ type: 'actions 名字', ...参数对象 })
    
    // this.$store.dispatch('GET_COUNTER')

    this.GET_COUNTER()
  }
}
</script>

<style>

</style>